/**
 * Created by kangdaye on 16/6/5.
 */

//Main
app.controller('orderListCtr',["$scope","$rootScope","orderListCache","orderListService", function($scope,$rootScope,orderListCache,orderListService) {
    $scope.tab = orderListCache.listTab;
    $scope.selectTable = $scope.tab[0];
    $scope.getData = {
        status : undefined,
        query : '',  //查询关键字
        applyRefund : false,   //是否申请退款的订单
        pageNo : 1,
        pageSize : 10
    };

    $scope.listData = {};

    $scope.getListDataFn = function(){
        orderListService.list($scope.getData,function(data){
            $scope.listData = data.data;
        });
    };

    $scope.tabClick = function(itemTable){
        $scope.selectTable = itemTable;
        $scope.getData.status = itemTable.status;
        $scope.getData.applyRefund = itemTable.applyRefund;
        $scope.getListDataFn();
    };
    
    $scope.getListDataFn();
}]);
